import { IParam } from '../../common';
import { ICtrlActionResult } from '../data-action';
import { EditFormActionType } from '../event';
import { IFormAbility } from './i-form-ability';

/**
 * 编辑表单能力接口
 *
 * @export
 * @interface IEditFormAbility
 * @extends {IFormAbility}
 */
export interface IEditFormAbility extends IFormAbility {
	/**
	 * 加载数据
	 *
	 * @param {IParam} [opts]
	 * @return {*}  {Promise<ICtrlActionResult>}
	 * @memberof IEditFormAbility
	 */
	load(opts?: IParam): Promise<ICtrlActionResult>;

	/**
	 * 保存
	 *
	 * @param {IParam} [opts]
	 * @param {boolean} [showResultInfo]
	 * @param {boolean} [isStateNext]
	 * @return {*}  {Promise<ICtrlActionResult>}
	 * @memberof IEditFormAbility
	 */
	save(
		opts?: IParam,
		showResultInfo?: boolean,
		isStateNext?: boolean
	): Promise<ICtrlActionResult>;

	/**
	 * 删除
	 *
	 * @param {IParam} [opts]
	 * @return {*}  {Promise<ICtrlActionResult>}
	 * @memberof IEditFormAbility
	 */
	remove(opts?: IParam): Promise<ICtrlActionResult>;

	/**
	 * 工作流提交
	 *
	 * @param {IParam[]} data
	 * @param {IParam} [opts]
	 * @return {*}  {Promise<ICtrlActionResult>}
	 * @memberof IEditFormAbility
	 */
	wfSubmit(data: IParam[], opts?: IParam): Promise<ICtrlActionResult>;

	/**
	 * 获取成员模型
	 *
	 * @return {*}  {IParam}
	 * @memberof IEditFormAbility
	 */
	getDetailModel(): IParam;

	/**
	 * 面板行为
	 *
	 * @param {string} [action] 调用的实体行为
	 * @param {string} [emitAction] 抛出行为
	 * @param {*} [data={}] 传入数据
	 *
	 * @memberof IEditFormAbility
	 */
	panelAction(action: string, emitAction: EditFormActionType, data: any): void;
}
